import React, { Component } from 'react'
import pxPage from '../../../root/pxPage'
import { ImagePicker } from 'antd-mobile';
import { getMsg, errToast } from '../../../redux/actionCreator'
// import { modifyuser } from '../../../../redux/actionCreator/modifyuser'
import { withRouter } from "react-router-dom"
import { connect } from 'react-redux'
import {addfeedbackbus} from '../../../redux/actionCreator/feedback'

class Feedback_bus extends Component {
    constructor(props) {
        super(props)
        this.state = {
            inpvalue: ''
        }
        this.handleChange = this.handleChange.bind(this);//手动绑定
    }

    handleChange(e) {
        this.setState({ inpvalue: e.target.value })
    }

    render() {
        return (
            <div style={{ minHeight: '100vh', display: 'flex', width: '100%' }}>

                <div style={{ backgroundColor: "#080904", minHeight: '100vh', display: 'flex', width: '100%' }}>

                    <div className="feedback-div" style={{ width: '90%', margin: '0 auto' }}>
                        <div style={{ height: '20px' }}></div>

                        <i className="iconfont icon-fanhui" style={{ fontSize: '1.7em' }} onClick={() => this.props.history.goBack()}></i>

                        <div style={{ fontSize: '1.5em', fontWeight: 'bold', paddingTop: '25px', paddingBottom: '20px' }}>我要反馈</div>

                        <textarea
                            value={this.state.inpvalue}
                            ref={inp => this.input = inp}
                            onChange={this.handleChange}
                            placeholder="请填写你的反馈"
                            className="feedback-textarea">
                        </textarea>

                        <div style={{ textAlign: 'center' }}>
                            <button
                                onClick={()=>{this.props.dispatch(addfeedbackbus(JSON.parse(localStorage.getItem('user')).business_id, this.state.inpvalue)) 
                                    this.props.history.goBack()
                                }}
                                className="feedback-commit"
                            >提交</button>
                            <button
                                onClick={() => this.setState({ inpvalue: '' })}
                                className="feedback-clear">清空</button>
                        </div>

                    </div>

                </div>
                <div style={{ flex: '1' }}></div>
            </div>
        )
    }
}

export default withRouter(connect()(Feedback_bus))
